package com.ugoodtech.mdcc.web.service.impl;

import com.mysema.query.BooleanBuilder;
import com.ugoodtech.mdcc.core.Constants;
import com.ugoodtech.mdcc.core.domain.QStationPaintReport;
import com.ugoodtech.mdcc.core.domain.StationLeanPaintSatisfactionReport.*;
import com.ugoodtech.mdcc.core.domain.StationPaintReport;
import com.ugoodtech.mdcc.core.domain.StationReport;
import com.ugoodtech.mdcc.core.repository.*;
import com.ugoodtech.mdcc.web.dto.JsonResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class StationPaintReportImpl implements com.ugoodtech.mdcc.web.service.StationPaintReport {

    private static final Logger logger = LoggerFactory.getLogger(StationPaintReportImpl.class);

    @Autowired
    private OperationalDataAnalysisRepository operationalDataAnalysisRepository;

    @Autowired
    private StationLeanPaintSatisfactionReportRepository stationLeanPaintSatisfactionReportRepository;

    @Autowired
    private UnitOperationsRepository unitOperationsRepository;

    @Autowired
    private OverallOperationsRepository overallOperationsRepository;

    @Autowired
    private EconomicDataRepository economicDataRepository;

    @Autowired
    private StationPaintReportRepository stationPaintReportRepository;

    @Autowired
    private StationReportRepository stationReportRepository;

    @Autowired
    private StationColorReportRepository stationColorReportRepository;

    //平均单车面数
    private Double oneAveragePer;
    //月均维修面数
    private Double monthAverageMaintenancePer;

    //保留2位小数 并转成String
    private String doubleGeTowDecimal(Double doubleNum) {
        if (doubleNum == null) {
            return "0.00";
        }
        DecimalFormat format = new DecimalFormat("0.00#");
        String doubleStr = format.format(doubleNum);
        try {
            return new String(doubleStr.getBytes("UTF-8"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return "0.00";
        }
    }

    /**
     * 生成单元运营一览
     *
     * @param operationalDataAnalysis
     * @returntring
     */
    private UnitOperations createUnitOperations(OperationalDataAnalysis operationalDataAnalysis, Long stationId, Integer index) {
        UnitOperations unitOperations = new UnitOperations();
        unitOperations.setStationId(stationId);
        unitOperations.setReportId(operationalDataAnalysis.getReportId());
//        unitOperations.setImprovementTimStr(operationalDataAnalysis.getImprovementTimStr());
        unitOperations.setIndexId(index);
        if (StringUtils.isNotEmpty(operationalDataAnalysis.getPrayPaintOfAverage())) {
            //G14=G5/G6
            logger.info("计算：单车平均产值");
            Double oneAverageValues = Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum());
            unitOperations.setOneAverageValues(doubleGeTowDecimal(oneAverageValues));
            logger.info("结果：" + oneAverageValues);
            //G15=G14/G91
            logger.info("计算：平均单车面数");
            oneAveragePer = 0d;
            oneAveragePer = oneAverageValues / Double.valueOf(operationalDataAnalysis.getPrayPaintOfAverage());
            unitOperations.setOneAveragePer(doubleGeTowDecimal(oneAveragePer));
            logger.info("结果：" + oneAveragePer);

            logger.info("计算：月均维修面数");
            monthAverageMaintenancePer = 0d;
//            =G15*G6
            monthAverageMaintenancePer = oneAveragePer * Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum());
            unitOperations.setMonthAverageMaintenancePer(doubleGeTowDecimal(monthAverageMaintenancePer));
            logger.info("结果：" + monthAverageMaintenancePer);

            logger.info("计算：单工位维修台次/月");
            Double OneStationMaintenanceNum_Month = Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) / Double.valueOf(operationalDataAnalysis.getPrayPaintOfStationNum());
            unitOperations.setOneStationMaintenanceNum_Month(doubleGeTowDecimal(OneStationMaintenanceNum_Month));
            logger.info("结果：" + OneStationMaintenanceNum_Month);
//             =G16/G8
            logger.info("计算：单工位维修面数/月");
            Double OneStationMaintenancePer_Month = monthAverageMaintenancePer / Double.valueOf(operationalDataAnalysis.getPrayPaintOfStationNum());
            unitOperations.setOneStationMaintenancePer_Month(doubleGeTowDecimal(OneStationMaintenancePer_Month));
            logger.info("结果：" + OneStationMaintenancePer_Month);

            logger.info("计算：单工人维修台次/月");
            Double OneWorkerMaintenanceNum_Month = Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfPersonNum());
            unitOperations.setOneWorkerMaintenanceNum_Month(doubleGeTowDecimal(OneWorkerMaintenanceNum_Month));
            logger.info("结果：" + OneWorkerMaintenanceNum_Month);
//             =G16/G7
            logger.info("计算：单工人维修面数/月");
            Double OneWorkerMaintenancePer_Month = monthAverageMaintenancePer / Double.valueOf(operationalDataAnalysis.getSprayPaintOfPersonNum());
            unitOperations.setOneWorkerMaintenancePer_Month(doubleGeTowDecimal(OneWorkerMaintenancePer_Month));
            logger.info("结果：" + OneWorkerMaintenancePer_Month);

            logger.info("计算：单工位产值（元）");
            Double OneStationOutPutValue = Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth()) / Double.valueOf(operationalDataAnalysis.getPrayPaintOfStationNum());
            unitOperations.setOneStationOutPutValue(doubleGeTowDecimal(OneStationOutPutValue));
            logger.info("结果：" + OneStationOutPutValue);

            logger.info("单工人产值/元");
            Double OnePersonOutPutValue = Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfPersonNum());
            unitOperations.setOnePersonOutPutValue(doubleGeTowDecimal(OnePersonOutPutValue));
            logger.info("结果：" + OnePersonOutPutValue);
        }


        return unitOperationsRepository.save(unitOperations);
    }

    /**
     * 总体产能一览
     *
     * @param operationalDataAnalysis
     * @return
     */
    private OverallOperations createOverallOperations(OperationalDataAnalysis operationalDataAnalysis, Long stationId, Integer index) {
//        获取 天工作时间和月工作天数============================
        StationPaintReport dayWorkTimeReport = stationPaintReportRepository.selectAnswerByQuestion(operationalDataAnalysis.getReportId(), Constants.day_work_time_question_id);
        StationPaintReport weekWorkdayReport = stationPaintReportRepository.selectAnswerByQuestion(operationalDataAnalysis.getReportId(), Constants.week_wx_question_id);
//        int dayWorkTime = Integer.parseInt(dayWorkTimeReport.getAnswerOther());
//        int monthWorkday = Integer.parseInt(weekWorkdayReport.getAnswerOther()) * 4;
        OverallOperations overallOperations = new OverallOperations();
        overallOperations.setStationId(stationId);
        overallOperations.setReportId(operationalDataAnalysis.getReportId());
//        overallOperations.setImprovementTimStr(operationalDataAnalysis.getImprovementTimStr());
        overallOperations.setIndexId(index);
        if (StringUtils.isNotEmpty(operationalDataAnalysis.getPrayPaintOfAverage())) {
            logger.info("计算：目前烤房最大产能（台）");
            Double brankStationMaxCapacity_A = Double.valueOf(operationalDataAnalysis.getBrankStationNum()) * 5.5 * 30;
            overallOperations.setBrankStationMaxCapacity_A(doubleGeTowDecimal(brankStationMaxCapacity_A));
            logger.info("结果：" + brankStationMaxCapacity_A);

            logger.info("计算：目前烤房最大产能（面）");
//            =G12*5.5*G15*30
            Double brankStationMaxCapacity_Face = Double.valueOf(operationalDataAnalysis.getBrankStationNum()) * 5.5 * oneAveragePer * 30;
            overallOperations.setBrankStationMaxCapacity_Face(doubleGeTowDecimal(brankStationMaxCapacity_Face));
            logger.info("结果：" + brankStationMaxCapacity_Face);

            logger.info("计算：烤房利用率");
            Double brankStationUtilization = 0d;
            if (brankStationMaxCapacity_A == 0) {
                overallOperations.setBrankStationUtilization("0");
            } else {
                brankStationUtilization = Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) / brankStationMaxCapacity_A;
                overallOperations.setBrankStationUtilization(doubleGeTowDecimal(brankStationUtilization));
            }
            logger.info("结果：" + brankStationUtilization);

            logger.info("计算：目前人工最大产能（台）");
            Double personMaxCapacity_A = Double.valueOf(operationalDataAnalysis.getSprayPaintOfPersonNum()) * 8 * Constants.month_work_day_count / Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) * 26 * 0.8;
            overallOperations.setPersonMaxCapacity_A(doubleGeTowDecimal(personMaxCapacity_A));
            logger.info("结果：" + personMaxCapacity_A);

            logger.info("计算：目前人工最大产能（面）");
            Double personMaxCapacity_Face = Double.valueOf(operationalDataAnalysis.getSprayPaintOfPersonNum()) * 8 * Constants.month_work_day_count / Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) * 26 * oneAveragePer * 0.8;
            overallOperations.setPersonMaxCapacity_Face(doubleGeTowDecimal(personMaxCapacity_Face));
            logger.info("结果：" + personMaxCapacity_Face);

            logger.info("计算：工人利用率");
            Double workersUtilization = monthAverageMaintenancePer / personMaxCapacity_Face;
            overallOperations.setWorkersUtilization(doubleGeTowDecimal(workersUtilization));
            logger.info("结果：" + workersUtilization);

            logger.info("计算：目前工位最大产能（台）");
            Double stationMaxCapacity_A = Double.valueOf(operationalDataAnalysis.getPrayPaintOfStationNum()) * 8 * 30 / Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) * 30 / 1.5;
            overallOperations.setStationMaxCapacity_A(doubleGeTowDecimal(stationMaxCapacity_A));
            logger.info("结果：" + stationMaxCapacity_A);

            logger.info("计算：目前工位最大产能（面）");
            Double stationMaxCapacity_Face = stationMaxCapacity_A * oneAveragePer;
            overallOperations.setStationMaxCapacity_Face(doubleGeTowDecimal(stationMaxCapacity_Face));
            logger.info("结果：" + stationMaxCapacity_Face);

            logger.info("计算：工位利用率");
            Double stationUtilization = Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum()) / stationMaxCapacity_A;
            overallOperations.setStationUtilization(doubleGeTowDecimal(stationUtilization));
            logger.info("结果：" + stationUtilization);
        }
        return overallOperationsRepository.save(overallOperations);
    }

    /**
     * 经济性数据
     *
     * @param operationalDataAnalysis
     * @return
     */
    private EconomicData createEconomicData(OperationalDataAnalysis operationalDataAnalysis, Long stationId, Integer index) {
        EconomicData economicData = new EconomicData();
        economicData.setStationId(stationId);
        economicData.setReportId(operationalDataAnalysis.getReportId());
//        economicData.setImprovementTimStr(operationalDataAnalysis.getImprovementTimStr());
        economicData.setIndexId(index);

        if (StringUtils.isNotEmpty(operationalDataAnalysis.getPrayPaintOfAverage())) {
            logger.info("计算：返工率");
            Double ReworkRate = Double.valueOf(operationalDataAnalysis.getReworkNum()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfNum());
            economicData.setReworkRate(doubleGeTowDecimal(ReworkRate));
            logger.info("结果：" + ReworkRate);

            logger.info("计算：油漆成本占产值额比例");
            Double paintCostTotalOutPutValue = Double.valueOf(operationalDataAnalysis.getPaintMoney()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth());
            economicData.setPaintCostTotalOutPutValue(doubleGeTowDecimal(paintCostTotalOutPutValue));
            logger.info("结果：" + paintCostTotalOutPutValue);

            logger.info("计算：人工成本占产值额比例");
            Double personCostTotalOutPutValue = Double.valueOf(operationalDataAnalysis.getPainterMoneyOfMonth()) / Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth());
            economicData.setPersonCostTotalOutPutValue(doubleGeTowDecimal(personCostTotalOutPutValue));
            logger.info("结果：" + personCostTotalOutPutValue);

            logger.info("计算：单面材料成本");
            Double singleMaterialCost = Double.valueOf(operationalDataAnalysis.getPaintMoney()) / monthAverageMaintenancePer;
            economicData.setSingleMaterialCost(doubleGeTowDecimal(singleMaterialCost));
            logger.info("结果：" + singleMaterialCost);

            logger.info("计算：单面人工成本");
            Double singlePersonCost = Double.valueOf(operationalDataAnalysis.getPainterMoneyOfMonth()) / monthAverageMaintenancePer;
            economicData.setSinglePersonCost(doubleGeTowDecimal(singlePersonCost));
            logger.info("结果：" + singlePersonCost);

            logger.info("计算：车间毛利");
            Double workShopGrossProfit = Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth()) - Double.valueOf(operationalDataAnalysis.getPaintMoney()) - Double.valueOf(operationalDataAnalysis.getPainterMoneyOfMonth());
            economicData.setWorkShopGrossProfit(doubleGeTowDecimal(workShopGrossProfit));
            logger.info("结果：" + workShopGrossProfit);

            logger.info("计算：车间毛利率");
            Double workShopGrossProfitMargin = workShopGrossProfit / Double.valueOf(operationalDataAnalysis.getSprayPaintOfMonth());
            economicData.setWorkShopGrossProfitMargin(doubleGeTowDecimal(workShopGrossProfitMargin));
            logger.info("结果：" + workShopGrossProfitMargin);
        }
        return economicDataRepository.save(economicData);
    }


    /**
     * 生成KPI报告
     *
     * @param reportId
     * @return
     */
    @Override
    public JsonResponse createPaintKpi(Long reportId, Long stationId) {
        StationReport stationReport = stationReportRepository.findOne(reportId);
        if (stationReport == null) {
            return JsonResponse.errorResponseWithError("抱歉", "未找到此报告");
        }
        StationLeanPaintSatisfactionReport satisfactionReport = new StationLeanPaintSatisfactionReport();
        satisfactionReport.setReportUser(stationReport.getUser().getId());
        satisfactionReport.setReportId(reportId);
        satisfactionReport.setServiceComapny(stationReport.getStation().getName());
        satisfactionReport.setServoceCpmpanyAddress(stationReport.getStation().getAddress());
        satisfactionReport.setCreateTimeStr(stationReport.getCreationTimeStr());
        satisfactionReport.setContantPerson(stationReport.getStation().getContact());
        satisfactionReport.setStationId(stationId);


        QStationPaintReport qStationPaintReport = QStationPaintReport.stationPaintReport;
        BooleanBuilder builder = new BooleanBuilder();
        builder.and(qStationPaintReport.deleted.eq(false));
        builder.and(qStationPaintReport.enabled.eq(true));
        builder.and(qStationPaintReport.stationReport.id.eq(reportId));
        List<StationPaintReport> reportList = (List<StationPaintReport>) stationPaintReportRepository.findAll(builder);

        //封装运营数据分析一览
        OperationalDataAnalysis operationalDataAnalysis = new OperationalDataAnalysis();
        operationalDataAnalysis.setReportId(reportId);
        operationalDataAnalysis.setStationId(stationReport.getStation().getId());
        operationalDataAnalysis = operationalDataAnalysis(reportList, operationalDataAnalysis, stationId);
        satisfactionReport.setOperationalDataAnalysis(operationalDataAnalysis);

//        //封装单元运营一览
//        UnitOperations unitOperations = createUnitOperations(operationalDataAnalysis, stationId);
//        satisfactionReport.setUnitOperations(unitOperations);
//
//        //总体产能一览
//        OverallOperations overallOperations = createOverallOperations(operationalDataAnalysis, stationId);
//        satisfactionReport.setOverallOperations(overallOperations);
//
//        //经济性数据
//        EconomicData economicData = createEconomicData(operationalDataAnalysis, stationId);
//        satisfactionReport.setEconomicData(economicData);
//        satisfactionReport.setImprovementTimStr(operationalDataAnalysis.getImprovementTimStr());

        try {
            stationLeanPaintSatisfactionReportRepository.save(satisfactionReport);
            logger.info("存储成功");
            return JsonResponse.successResponse();
        } catch (Exception e) {
            logger.info("存储失败");
            e.printStackTrace();
            return JsonResponse.errorResponseWithError("抱歉", "创建KPI报告失败");
        }

    }

    /**
     * 获取提交上来的数据，并生成运营数据
     *
     * @param reportList
     * @param operationalDataAnalysis
     * @return
     */
    private OperationalDataAnalysis operationalDataAnalysis(List<StationPaintReport> reportList, OperationalDataAnalysis operationalDataAnalysis, Long stationId) {
        for (StationPaintReport report : reportList) {
            if (report.getQuestionId() == null || report.getQuestionId() == 0) {
                break;
            }
            if (report.getQuestionId() == 172) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
                logger.info("改善月内容为：" + report.getAnswerOther());
                String dateTimeStr = simpleDateFormat.format(new Date(Long.valueOf(report.getAnswerOther())));
                logger.info("dateTimeStr=" + dateTimeStr);
                operationalDataAnalysis.setImprovementTimStr(dateTimeStr);
            }
            if (report.getQuestionId() == 146) {
                operationalDataAnalysis.setSprayPaintOfMonth(report.getAnswerOther());
            }
            if (report.getQuestionId() == 147) {
                operationalDataAnalysis.setSprayPaintOfNum(report.getAnswerOther());
            }
            if (report.getQuestionId() == 148) {
                operationalDataAnalysis.setSprayPaintOfPersonNum(report.getAnswerOther());
            }
            if (report.getQuestionId() == 149) {
                operationalDataAnalysis.setPrayPaintOfStationNum(report.getAnswerOther());
            }
            if (report.getQuestionId() == 150) {
                operationalDataAnalysis.setPrayPaintOfAverage(report.getAnswerOther());
            }
            if (report.getQuestionId() == 151) {
                operationalDataAnalysis.setPaintMoney(report.getAnswerOther());
            }
            if (report.getQuestionId() == 152) {
                operationalDataAnalysis.setPainterMoneyOfMonth(report.getAnswerOther());
            }
            if (report.getQuestionId() == 153) {
                operationalDataAnalysis.setBrankStationNum(report.getAnswerOther());
            }
            if (report.getQuestionId() == 154) {
                operationalDataAnalysis.setReworkNum(report.getAnswerOther());
            }
        }
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
//        String dateTimeStr = simpleDateFormat.format(operationalDataAnalysis.getImprovementTimStr());
        operationalDataAnalysis.setImprovementTimStr(operationalDataAnalysis.getImprovementTimStr());
        operationalDataAnalysis.setStationId(stationId);
        operationalDataAnalysisRepository.save(operationalDataAnalysis);
        return operationalDataAnalysis;
    }

    private static Integer[] index = new Integer[7];

    static {
        for (int i = 0; i < index.length; i++) {
            index[i] = i;
        }
    }

    @Override
    public JsonResponse calculateKpiData(Long reportId, Long stationId) {
        QOperationalDataAnalysis qOperationalDataAnalysis = QOperationalDataAnalysis.operationalDataAnalysis;
        BooleanBuilder builder = new BooleanBuilder();
        builder.and(qOperationalDataAnalysis.deleted.eq(false));
        builder.and(qOperationalDataAnalysis.enabled.eq(true));
        builder.and(qOperationalDataAnalysis.stationId.eq(stationId));
        builder.and(qOperationalDataAnalysis.reportId.eq(reportId));
        builder.and(qOperationalDataAnalysis.indexId.in(index));
        List<OperationalDataAnalysis> operationalDataAnalysisList = (List<OperationalDataAnalysis>) operationalDataAnalysisRepository.findAll(builder);
        //删除经济性数据
        logger.info("删除原有的经济性数据表格");
        QEconomicData qEconomicData = QEconomicData.economicData;
        builder = new BooleanBuilder();
        builder.and(qEconomicData.deleted.eq(false));
        builder.and(qEconomicData.enabled.eq(true));
        builder.and(qEconomicData.reportId.eq(reportId));
        builder.and(qEconomicData.stationId.eq(stationId));
        List<EconomicData> economicDataList = (List<EconomicData>) economicDataRepository.findAll(builder);
        for (EconomicData data : economicDataList) {
            data.setDeleted(true);
            data.setEnabled(false);
            economicDataRepository.save(data);
        }
        //删除总体产能一览
        logger.info("删除原有的总体产能一览表格");
        QOverallOperations qOverallOperations = QOverallOperations.overallOperations;
        builder = new BooleanBuilder();
        builder.and(qOverallOperations.deleted.eq(false));
        builder.and(qOverallOperations.enabled.eq(true));
        builder.and(qOverallOperations.reportId.eq(reportId));
        builder.and(qOverallOperations.stationId.eq(stationId));
        List<OverallOperations> overallOperationsList = (List<OverallOperations>) overallOperationsRepository.findAll(builder);
        for (OverallOperations data : overallOperationsList) {
            data.setDeleted(true);
            data.setEnabled(false);
            overallOperationsRepository.save(data);
        }

        //删除单元运营一览
        logger.info("删除原有的单元运营一览表格");
        QUnitOperations qUnitOperations = QUnitOperations.unitOperations;
        builder = new BooleanBuilder();
        builder.and(qUnitOperations.deleted.eq(false));
        builder.and(qUnitOperations.enabled.eq(true));
        builder.and(qUnitOperations.reportId.eq(reportId));
        builder.and(qUnitOperations.stationId.eq(stationId));
        List<UnitOperations> unitOperationsList = (List<UnitOperations>) unitOperationsRepository.findAll(builder);
        for (UnitOperations data : unitOperationsList) {
            data.setDeleted(true);
            data.setEnabled(false);
            unitOperationsRepository.save(data);
        }
        //计算数据
        logger.info("计算数据");
        for (OperationalDataAnalysis data : operationalDataAnalysisList) {
            Integer index = data.getIndexId();
            if (data.getSprayPaintOfMonth().equals("0") && data.getSprayPaintOfNum().equals("0") && data.getSprayPaintOfPersonNum().equals("0")
                    && data.getPrayPaintOfStationNum().equals("0") && data.getPrayPaintOfAverage().equals("0") && data.getPaintMoney().equals("0")
                    && data.getPainterMoneyOfMonth().equals("0") && data.getBrankStationNum().equals("0") && data.getReworkNum().equals("0")) {
                UnitOperations unitOperations = new UnitOperations();
                unitOperations.setStationId(stationId);
                unitOperations.setReportId(data.getReportId());
                unitOperations.setIndexId(index);
                unitOperationsRepository.save(unitOperations);
                EconomicData economicData = new EconomicData();
                economicData.setStationId(stationId);
                economicData.setReportId(data.getReportId());
                economicData.setIndexId(index);
                economicDataRepository.save(economicData);
                OverallOperations overallOperations = new OverallOperations();
                overallOperations.setStationId(stationId);
                overallOperations.setReportId(data.getReportId());
                overallOperations.setIndexId(index);
                overallOperationsRepository.save(overallOperations);
                continue;
            }

            //生成单元运营一览
            createUnitOperations(data, stationId, index);
            //生成经济性数据
            createEconomicData(data, stationId, index);
            //生成总体产能一览
            createOverallOperations(data, stationId, index);
        }
        logger.info("生成完毕");
        logger.info("***********************************************************");
        return JsonResponse.successResponse();
    }

}
